<!-- /* Description for file.
 * 查看/删除日程(点击进入修改日程)
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/schedules
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0702
 * @lastmodified  张海杰2011年0702
 */
 -->

<?php
echo $html->css('start/jquery-ui-1.8.2.custom');
echo $javascript->link('jquery-ui-1.8.2.custom.min');
echo $html->css ( 'jquery-validate/css/screen' );
echo $html->css ( 'tab' );
?>

<script type="text/javascript">
//添加验证
$(document).ready(function() {
	$.validator.setDefaults({       
		 submitHandler: function(form) {    
		  form.submit();
		  var ref= "<?php echo $ref;?>";
		  if(ref!=1)
		  {  
			  	if(window.opener!=null){
			  		window.opener.location.reload();
			  		window.close();
			  	}
		  }     
		}       
	});   
			
	$("#ScheduleEditForm").validate({
		rules: {
			"data[Schedule][remindBefore]":{
			required: false,digits:true
			},//提前提醒
			"data[Schedule][remindSpacing]":{
				required: false,digits:true
				},//间隔提醒
				"data[Schedule][title]":{
					required: true,alowsome:true,stringMinLength:0,stringMaxLength:50
					},//主题
					"data[Schedule][context]":{
						required: false,stringMinLength:0,stringMaxLength:255
						},//内容
						"data[Schedule][recipient]":{
							required: false,alowsome:true,stringMinLength:0,stringMaxLength:200
							}//接受人
		},
		messages:{},
		focusInvalid:false,
		onkeyup:false,
		errorPlacement:function(error, element){error.appendTo(element.parent());}
	});
});
//验证结束
//remindBefore赋为radio按钮后的input的输入值
$(document).ready(function(){
	$("#close").click(function(){	
		window.close();							
	});
	$("#deletebutton").click(function(){
		if(!confirm("确定删除?"))
		{
			return;
		}
		window.location = "<?php echo ROOT_WEB_PATH; ?>/schedules/delete/<?php echo $schedule['Schedule']['id'];?>";
	  	if(window.opener!=null){
	  		window.opener.location.reload();
	  		window.close();
	  	}
	});
});

</script>
<style>
.txtRadio{width:60px;}
.input{
	float:left;
}
</style>
<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Personal Office');//一级目录
										   echo '>';echo __('Schedule');//二级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('Edit Schedule',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->

<?php echo $form->create('Schedule',array('action'=>'edit'));?>
<div class="tabflex" >
	<fieldset>
 		<legend><?php __('Create Message');?></legend>
 		 <table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
 		 <tr>
			<td>
			<?php
			echo $form->input('id',array('default'=>$schedule['Schedule']['id'])); 
			echo $form->hidden('modified ');
			echo $form->hidden('ref',array('default'=>$ref));
			echo $form->hidden('updater');?> </td>
		</tr>
		<tr>
			<td width="50"></td>
			<td width="100"><?php __('Creator');//创建人?>:</td>
			<td >
			<?php echo $form->input('creater',array('disabled'=>'disabled','class' => 'TextBoxH','label'=>false,'default'=>$schedule['Schedule']['creater']));?>
			</td>
			<td width="50"></td>
			<td width="100"><?php __('Create_Time');//创建时间?>:</td>
			<td >
			<?php echo $form->input('created',array('label'=>false,
					'dateFormat'=>'YMD', 'timeFormat'=> '24','disabled'=>'disabled','monthNames' => false,'selected' => $schedule['Schedule']['created']));?></td>
		</tr>
		<tr>
			<td width="50"></td>
			<td width="100"><?php __('Schedule remindBefore');//提前提醒?>:</td>
			<td >
				<table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
				<tr><!--
					<td width="200">
					<?php 
						//$options=array('0'=>$form->input('remindBeforeday',array('type'=>'text','label'=>false,'class'=>'txtRadio','default'=>'0','after' => '&nbsp;天')),
						//			   '1'=>$form->input('remindBeforeminute',array('type'=>'text','label'=>false,'class'=>'txtRadio','default'=>'0','after' => '&nbsp;分钟'))); 
						//$attributes=array('legend'=>false,'default'=>0,'class'=>'remindBefore'); 
						//echo $form->radio('remind',$options,$attributes);
						//echo $form->hidden('remindBefore');  ?> 
					</td>
					-->
					<td >
					<?php echo $form->input('remindBefore',array('type'=>'text','label'=>false,'class'=>'txtRadio','default'=>'0',
											'after' => '&nbsp;天','default'=>$schedule['Schedule']['remindBefore']));  ?> 
					</td>
				</tr>
				</table>
			</td>
			<td width="50"></td>
			<td width="100"><?php __('Schedule remindSpacing');//间隔提醒?>:</td>
			<td >
				<?php echo $form->input('remindSpacing',array('label'=>false,'class'=>'txtRadio','default'=>$schedule['Schedule']['remindSpacing'],'after'=>'&nbsp;'));?>
				<?php 
					$options = array('N'=>'不重复','D'=>'日','W'=>'周','M'=>'月','Y'=>'年');
					echo $form->input('repeatStyle',array('div'=>false,'label'=>false,'options'=>$options,'default'=>$repeatStyle))?>
			</td>
		</tr>
		<tr>
			<td width="50"></td>
			<td width="100"><?php __('StartUseTime');//开始时间?>:</td>
			<td >
			<?php echo $form->input('startDate',array('label'=>false,
					'dateFormat'=>'YMD', 'timeFormat'=> '24','monthNames' => false,'selected' => $schedule['Schedule']['startDate']));?></td>
			<td width="50"></td>
			<td width="100"><?php __('EndUseTime');//结束时间?>:</td>
			<td >
			<?php echo $form->input('endDate',array('label'=>false,
					'dateFormat'=>'YMD', 'timeFormat'=> '24','monthNames' => false,'selected' => $schedule['Schedule']['endDate']));?></td>
		</tr>
 		</table>	
 	</fieldset>
 	<fieldset>
 		<legend><?php __('Schedule Message');?></legend>
 		 <table width="100%" cellspacing="0" cellpadding="0" border="0" style="text-align: left">
 		 <tr>
 		 	<td width="50"></td>
 		 	<td colspan="5"><span><font color="red">注：不选择接收人时，系统默认为创建本人的日程</font></span></td>
 		 </tr>
		<tr>
			<td width="50"></td>
			<td width="100"><?php __('SchedulestyleName');//类型下拉?>:</td>		
			<td >
			<?php echo $form->input('scheduleStyle',array('options'=>$schedulestyles,'label'=>false,'div'=>false,
						'class'=>'TextBoxE1','default'=>$schedule['Schedule']['scheduleStyle']));?>
			</td>
			<td width="50"></td>
			<td width="100"><?php __('ImportanceName');//重要性下拉?>:</td>
			<td >
			<?php echo $form->input('importance',array('options'=>$importances,'label'=>false,'div'=>false,
						'class'=>'TextBoxE1','default'=>$schedule['Schedule']['importance']));?>
			</td>
		</tr>
		<tr>
			<td width="50"></td>
			<td width="100"><?php __('subject');//标题?>:<font color="red">*</font></td>
			<td colspan="4">
			<?php echo $form->input('title',array('class' => 'TextBoxH','label'=>false,'default'=>$schedule['Schedule']['title']));?>
			</td>
		</tr>
		<tr>
			<td width="50"></td>
			<td width="100"><?php __('Field_Value');//内容?>:</td>
			<td colspan="4">
			<?php echo $form->textarea('context',array('class' => 'areaStyle','label'=>false,'default'=>$schedule['Schedule']['context']));?>
			</td>
		</tr>
		<tr>
			<td width="50"></td>
			<td width="100"><?php __('Schedule recipient');//接收人?>:</td>
			<td >
			<?php echo $form->input('recipient',array('options'=>$receivers,'label'=>false,'div'=>false,'class'=>'TextBoxE1'
				,'default'=>$schedule['Schedule']['recipient']));?>
			</td>
			<td colspan="3"></td>
		</tr>
 		</table>	
 	</fieldset>
 </div>

 <table width="500px" cellspacing="0" cellpadding="0" border="0" style="float:left">
			<tr>
				<td width="100px"></td>
				<td width="100px">
				<?php echo $form->button('确定',array('type'=>'submit','class'=>'btn2','id'=>'addissubmit'));?><!-- 确定-->
				</td>
				<td width="100px">
				<?php echo $form->button('重置',array('type'=>'reset','class'=>'btn2'));?><!-- __('reset', true)取消-->
				</td>
				<td width="100px"><!--
				<a style="float:left" href="<?php echo ROOT_WEB_PATH; ?>/schedules/delete/<?php //echo $schedule['Schedule']['id'];?>" onclick="confirm("确认删除?");" >
				<?php //echo $html->image('delete.gif', array('alt' =>  __('Delete', true),'border'=>'0'));  ?>&nbsp;删除</a>
				-->
				<?php echo $form->button('删除',array('type'=>'button','class'=>'btn2','id'=>'deletebutton'));?>
					
				</td>              <!--  __('delete', true) 删除、提示 -->
				<td width="100px">
				<?php echo $form->button('关闭',array('type'=>'button','class'=>'btn2','id'=>'close'));?>
				</td>
				<td></td>
			</tr>
</table>
<?php echo $form->end();?><!-- 提交表单-->
